﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<jsp:useBean id="dateValue" class="java.util.Date"/>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <!-- jsp文件头和头部 -->
    <%@ include file="../admin/top.jsp" %>
    <style>
        table tr td img {
            height: 25px;
            border-radius: 8%;
        }
    </style>
</head>
<body>
<div class="container-fluid" id="main-container">
    <div id="page-content" class="clearfix">
        <div class="row-fluid">
            <div class="row-fluid">
                <!-- 检索  -->
                <form action="payOrderInfo/list" method="post" name="productionForm" id="productionForm">
                    <input type="hidden" name="menuId" value="${page.menuId}">
                    <table style="width: 35%">
                        <tr>
                            <td style="vertical-align:top;">
                                <select class="chzn-select" name="productionType" data-values="${productionType}"
                                        data-placeholder="选择产品类型" style="vertical-align:top;width: 120px;">
                                    <option value="">选择产品类型</option>
                                    <option value="1" <c:if test="${productionType == '1'}">selected</c:if>>月会员</option>
                                    <option value="2" <c:if test="${productionType == '2'}">selected</c:if>>年会员</option>
                                    <option value="3" <c:if test="${productionType == '3'}">selected</c:if>>永久会员</option>
                                    <option value="4" <c:if test="${productionType == '4'}">selected</c:if>>金币</option>
                                    <%--<c:forEach items="${channels}" var="channel">
                                        <option value="${channel.channelCode}"
                                                <c:if test="${channel.channelCode eq channelCode}">selected</c:if> >${channel.name}</option>
                                    </c:forEach>--%>
                                </select>
                            </td>
                            <td style="vertical-align:top;">
                                <button class="btn btn-mini btn-light" onclick="search();" title="检索">
                                    <i id="nav-search-icon" class="icon-search"></i>
                                </button>
                            </td>
                            <td style="vertical-align:top;">
                                <c:if test="${fn:contains(butSet, 'add')}">
                                    <a class="btn btn-small btn-success" onclick="add();">新增</a>
                                </c:if>
                            </td>
                        </tr>
                    </table>
                    <!-- 检索  -->
                    <table id="table_report" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th></th>
                            <th>产品名称</th>
                            <th>产品类型</th>
                            <th>特权信息</th>
                            <th>是否为推荐会员</th>
                            <th>产品原价</th>
                            <th>产品现价</th>
                            <th>币种</th>
                            <th>产品说明</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <!-- 开始循环 -->
                        <c:choose>
                            <c:when test="${not empty productionInfos}">
                                <c:forEach items="${productionInfos}" var="productionInfo">
                                    <tr style="text-align: center">
                                        <td>${productionInfo.id }</td>
                                        <td>${productionInfo.name}</td>
                                        <td>
                                            <c:choose>
                                                <c:when test="${productionInfo.type == 1}">
                                                    包月
                                                </c:when>
                                                <c:when test="${productionInfo.type == 2}">
                                                    包年
                                                </c:when>
                                                <c:when test="${productionInfo.type == 3}">
                                                    永久
                                                </c:when>
                                                <c:when test="${productionInfo.type == 4}">
                                                    金币
                                                </c:when>
                                                <c:otherwise>
                                                    未知
                                                </c:otherwise>
                                            </c:choose>
                                        </td>
                                        <td>${productionInfo.privilegeInfo}</td>
                                        <td>${productionInfo.isRecommend}</td>
                                        <td>${productionInfo.originalPriceDesc}</td>
                                        <td>${productionInfo.priceDesc}</td>
                                        <td>${productionInfo.currency}</td>
                                        <td></td>
                                        <td><fmt:formatDate value="${productionInfo.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                        <td>
                                           <%-- <c:if test="${payOrderInfo.orderStatus == 1 && !'applePay'.equals(payOrderInfo.paymentMethod)}">
                                                <a class="btn btn-mini" onclick="operateDev('${payOrderInfo.id}', 0)">退款申请</a>
                                            </c:if>--%>
                                            <a class="btn btn-mini" onclick="queryProductionDetail('${productionInfo.id}')">详情</a>
                                            <p></p>
                                            <a class="btn btn-mini" onclick="edit('${productionInfo.id}')">编辑</a>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:when>
                            <c:otherwise>
                                <tr class="main_info">
                                    <td colspan="11" class="center">没有相关数据</td>
                                </tr>
                            </c:otherwise>
                        </c:choose>
                        </tbody>
                    </table>
                    <div class="page-header position-relative">
                        <table style="width:100%;">
                            <tr>
                                <td style="vertical-align:top;">
                                    <div class="pagination"
                                         style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 返回顶部  -->
<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
    <i class="icon-double-angle-up icon-only"></i>
</a>
<!-- 引入 -->
<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/ace-elements.min.js"></script>
<script src="static/js/ace.min.js"></script>

<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
<!-- 引入 -->
<script type="text/javascript" src="static/js/jquery.tips.js"></script><!--提示框-->
<script type="text/javascript">
    $(top.hangge());

    //检索
    function search() {
        top.jzts();
        $("#payOrderForm").submit();
    }

    //新增
    function add() {
        top.jzts();
        var diag = new top.Dialog();
        diag.Drag = true;
        diag.Title = "新增产品";
        diag.URL = '<%=basePath%>production/toAddProduct';
        diag.Width = 600;
        diag.Height = 850;
        diag.CancelEvent = function () { //关闭事件
            if (diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none') {
                if ('${page.currentPage}' == '0') {
                    top.jzts();
                    $("#productionForm").submit();
                } else {
                    nextPage(${page.currentPage});
                }
            }
            diag.close();
        };
        diag.show();
    }
    //查询产品详细信息
    function queryProductionDetail(id){
        var url =
        top.jzts();
        var diag = new top.Dialog();
        diag.Drag = true;
        diag.Title = "产品详情";
        diag.URL = "<%=basePath%>production/queryDetail?id="+id;
        diag.Width = 600;
        diag.Height = 850;
        diag.CancelEvent = function () { //关闭事件
            if (diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none') {
                if ('${page.currentPage}' == '0') {
                    top.jzts();
                } else {
                    nextPage(${page.currentPage});
                }
            }
            diag.close();
        };
        diag.show();
    }

    //编辑
    function edit(id) {
        top.jzts();
        var diag = new top.Dialog();
        diag.Drag = true;
        diag.Title = "产品编辑";
        diag.URL = '<%=basePath%>production/toEditProduct?id=' + id;
        diag.Width = 600;
        diag.Height = 850;
        diag.CancelEvent = function () { //关闭事件
            if (diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none') {
                if ('${page.currentPage}' == '0') {
                    top.jzts();
                    $("#productionForm").submit();
                } else {
                    nextPage(${page.currentPage});
                }
            }
            diag.close();
        };
        diag.show();
    }
</script>

<script type="text/javascript">
    $(function () {
        //日期框
        $('.date-picker').datepicker({autoclose: true});
        //下拉框
        $(".chzn-select").chosen();
        $(".chzn-select-deselect").chosen({allow_single_deselect: true});
        //复选框
        $('table th input:checkbox').on('click', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });
        });
    });
</script>
</body>
</html>
